<?php

use think\migration\Seeder;
use think\facade\Db;

class Users extends Seeder
{
    public function run()
    {
        // faker默认语言是英文会生成英文的数据，在创建实例的时候可以指定为中文
        $faker = Faker\Factory::create('zh_CN');
        $rows = [];
        for ($i = 0; $i < 50; $i++) {
            $rows[] = [
                'username'      => $faker->name,
                'password'      => md5($faker->password),
                 'phone'         => $faker->phoneNumber,
            ];
        }
 
        Db::table('users')->insertAll($rows);  //要引用Db
    }
}